#4 Introduction to the Command-line
Faculty of Humanities and Social Sciences
University of Lucerne
14 March 2025
| Date | Topic |
|---|---|
| 22 February 2025 | Introduction + Where is the digital revolution? |
| 29 February 2025 | Text as Data |
| 07 March 2025 | Setting up your Development Environment |
| 14 March 2025 | Introduction to the Command-line |
| 21 March 2025 | Basic NLP with Command-line |
| 28 March 2025 | Introduction to Python in VS Code |
| 04 April 2025 | no lecture (Osterpause) |
| 11 April 2025 | Working with (your own) Data |
| 18 April 2025 | Data Analysis of Swiss Media |
| 25 April 2025 (Zoom) | Ethics and the Evolution of NLP |
| 02 May 2025 (Zoom) | NLP with Python |
| 09 May 2025 | no lecture (Christi Himmelfahrt) |
| 16 May 2025 | NLP with Python II + Working Session |
| 23 May 2025 | Mini-Project Presentations + Discussion |
| 30 May 2025 | no lecture (Fronleichnam) |
TerminalzshUbuntu 22.04 LTSBashUSER@HOSTNAME:DIRECTORY$~ refers to /home/USERBuild small programs that do one thing
and do it well. 🤓
Illustration of a file cabinet (Powers et al. 2002)
/ (uppermost folder)/home/alex/KED2025/slides/KED2025_01.htmlKED2025/slides/KED2025_01.htmlYou are in /home/myuser/documents containing
the subfolders pictures and texts.
What is the absolute path to texts?
What is the relative path to texts?
⚠️ Only relative paths work across systems
shortcut names of directories
. current dir.. parent dir~ home dir (e.g. /home/alex)find your files on Windows
/mnt/c/Users/USERNAME/ (replace with your USERNAME)documentsTABSPACEBARCTRL + Cq or CTRL + DWatch out, there is no recycle bin. No way back!
tmp in your home directory.cd and print its absolute path using pwd.touch to create a new file called magic.txt in tmp.magic.txt to easy_as_pie.txt.easy_as_pie.txt file using your graphical file manager (Windows: Explorer, Mac: Finder)mv command.cd and ls. Where are your personal files located?text_1.txt vs. textsSOURCE/YEAR/speech_party_X.txt?*>>>| (pipe)Create a new file with touch.
Write the following content into that file, one line at a time using the append operator:
Make sure that the content was written into that file using more.
Navigate up and down in in your filesystem using cd and list the respective files per directory with ls. Where can you find your personal documents? Print the absolute path with pwd.
Windows users may have a look at /mnt/c/Users since they are working on a Ubuntu subsystem.
Read man ls and write an ls command that lists your documents ordered
Use the | and > operators to write the 3 “last modified” files in your documents folder into a file called last-modified.txt on your desktop (desktop is also a directory). Write a single command performing multiple operations using operators.